<?php
$content = new Models_Articles();
//var_dump($_POST);
//var_dump($_SESSION);
$valid = $content->validateSubArticle($_POST);
if(!$valid)
{
    $arr = array(
            $_POST['0'],
            $_POST['1'],
            $_POST['2'],
            $_POST['3'],
            $_POST['4'],
            $_COOKIE['user_id']
        );
    $content->editSubArticle($arr, $id);
    echo '<div class="alert alert-success"><h4>Successful!</h4></div>';
} else {
    require_once 'addsub.php';
    echo '<div class="alert alert-danger"><ul>';
    foreach ($valid as $error)
    {
        echo '<li>' . $error . '</li>';
    }
    echo '</ul></div>';
}
?>